package com.ruoyi.elebook.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.elebook.domain.BookMajor;
import com.ruoyi.elebook.mapper.BookMajorMapper;
import com.ruoyi.elebook.service.IBookMajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 专业Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-11
 */
@Service
public class BookMajorServiceImpl implements IBookMajorService 
{
    @Autowired
    private BookMajorMapper bookMajorMapper;

    /**
     * 查询专业
     * 
     * @param id 专业主键
     * @return 专业
     */
    @Override
    public BookMajor selectBookMajorById(Long id)
    {
        return bookMajorMapper.selectBookMajorById(id);
    }

    /**
     * 查询专业列表
     * 
     * @param bookMajor 专业
     * @return 专业
     */
    @Override
    public List<BookMajor> selectBookMajorList(BookMajor bookMajor)
    {
        return bookMajorMapper.selectBookMajorList(bookMajor);
    }

    /**
     * 新增专业
     * 
     * @param bookMajor 专业
     * @return 结果
     */
    @Override
    public int insertBookMajor(BookMajor bookMajor)
    {
        bookMajor.setCreateTime(DateUtils.getNowDate());
        return bookMajorMapper.insertBookMajor(bookMajor);
    }

    /**
     * 修改专业
     * 
     * @param bookMajor 专业
     * @return 结果
     */
    @Override
    public int updateBookMajor(BookMajor bookMajor)
    {
        bookMajor.setUpdateTime(DateUtils.getNowDate());
        return bookMajorMapper.updateBookMajor(bookMajor);
    }

    /**
     * 批量删除专业
     * 
     * @param ids 需要删除的专业主键
     * @return 结果
     */
    @Override
    public int deleteBookMajorByIds(Long[] ids)
    {
        return bookMajorMapper.deleteBookMajorByIds(ids);
    }

    /**
     * 删除专业信息
     * 
     * @param id 专业主键
     * @return 结果
     */
    @Override
    public int deleteBookMajorById(Long id)
    {
        return bookMajorMapper.deleteBookMajorById(id);
    }
}
